//
//  TTPayOrderDetailSuccessViewController.m
//  TaoTuo
//
//  Created by admin on 2019/12/16.
//  Copyright © 2019 admin. All rights reserved.
//

#import "TTPayOrderDetailSuccessViewController.h"

@interface TTPayOrderDetailSuccessViewController ()

@end

@implementation TTPayOrderDetailSuccessViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"支付成功";
    self.fd_interactivePopDisabled = YES;
    // 我的页面数字更新
    [[NSNotificationCenter defaultCenter] postNotificationName:@"refreshPageCountNotify" object:nil];
    
    [self setupSubviews];
}

- (void)backAction
{
    [self backToOrderDetailVC];
}

- (void)goToHome
{
    [LLRouteTool gotoHomeViewController];
}

///查看订单详情
- (void)lookDetailClick
{
    [self backToOrderDetailVC];
}

- (void)backToOrderDetailVC
{
    [[NSNotificationCenter defaultCenter] postNotificationName:@"refreshDatasNotify_key" object:nil];
    
    for (UIViewController *vc in self.navigationController.viewControllers) {
        if ([vc isKindOfClass:NSClassFromString(@"TTOrderDetailViewController")]) {
            [self.navigationController popToViewController:vc animated:YES];
            break;
        }
    }
}

- (void)setupSubviews
{
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"paysuccess"]];
    [self.view addSubview:imageView];
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_topLayoutGuideBottom).mas_offset(50);
        make.centerX.equalTo(self.view);
    }];
    
    UILabel *label = [UILabel labelWithTitle:@"支付成功" color:[UIColor blackColor] fontSize:18];
    [self.view addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(imageView.mas_bottom).mas_offset(21);
        make.centerX.equalTo(self.view);
    }];
    
    UIButton *btn = [UIButton createButtonWithTitle:@"继续选货" titleColor:[UIColor whiteColor] titleFont:[UIFont systemFontOfSize:16] backgroundColor:kMainColor cornerRadius:10 target:self action:@selector(goToHome)];
    btn.contentEdgeInsets = UIEdgeInsetsMake(6, 15, 6, 15);
    [self.view addSubview:btn];
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(label.mas_bottom).mas_offset(25);
        make.centerX.equalTo(self.view);
        make.height.mas_equalTo(40);
        make.width.mas_equalTo(250);
    }];
    
    UIButton *lookDetailBtn = [UIButton createButtonWithTitle:@"查看订单详情" titleColor:UIColorHex(666666) titleFont:[UIFont systemFontOfSize:15] backgroundColor:nil target:self action:@selector(lookDetailClick)];
    [self.view addSubview:lookDetailBtn];
    [lookDetailBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(btn.mas_bottom).mas_offset(30);
        make.centerX.equalTo(self.view);
    }];
    
    
}

@end
